package com.varian.tool.log;

import com.alibaba.ttl.TransmittableThreadLocal;
import lombok.experimental.UtilityClass;

/**
 * @author ben
 * @since 2024/9/18
 */
@UtilityClass
public class TraceIdContextHolder {

    private final ThreadLocal<String> TRACE_ID = new TransmittableThreadLocal<>();

    public String get() {
        return TRACE_ID.get();
    }

    public void set(String traceId) {
        TRACE_ID.set(traceId);
    }

    public void remove() {
        TRACE_ID.remove();
    }
}
